package interfaces.console.commands;

import interfaces.console.Console;
import fileHandling.ProfileHandler;

public class ChangeProfileCommand extends ArgumentCommand {
		
	public ChangeProfileCommand() {
		super("changeProfile");
	}
	
	@Override
	public String getCurrentValue() { return ProfileHandler.getSelectedProfile(); }
	
	@Override
	public boolean execute(Console console, String[] args) {
		if(args.length != 2) return false;
		String newDefaultProfile = args[1];
		if(!ProfileHandler.getProfiles().contains(newDefaultProfile)) return false;
		ProfileHandler.setSelectedProfile(newDefaultProfile, ProfileHandler.isAutoLogin());
		
		return true;
	}
}